.TH "/Users/matthieuriolo/Downloads/libgenc/branches/riolo/trunk/include/gen/control_macros.h" 3 "Wed Jan 11 2012" ""c generic library"" \" -*- nroff -*-
.ad l
.nh
.SH NAME
/Users/matthieuriolo/Downloads/libgenc/branches/riolo/trunk/include/gen/control_macros.h \- 
.SH SYNOPSIS
.br
.PP
\fC#include 'access_macros.h'\fP
.br

.SS "Defines"

.in +1c
.ti -1c
.RI "#define \fBLEFT\fP   0x00"
.br
.ti -1c
.RI "#define \fBRIGHT\fP   0x01"
.br
.ti -1c
.RI "#define \fBVALID\fP   0x01"
.br
.ti -1c
.RI "#define \fBINVALID\fP   0x00"
.br
.ti -1c
.RI "#define \fBBASE_INIT\fP(X, Y, Z, S)"
.br
.ti -1c
.RI "#define \fBBASE_INIT2\fP(X, Y, Z)"
.br
.ti -1c
.RI "#define \fBDELETE_OBJPTR\fP(PAR, OBJ)"
.br
.ti -1c
.RI "#define \fBADD_FREE_NODE\fP(X, Y)"
.br
.ti -1c
.RI "#define \fBREMOVE_NODE\fP(X, Y)"
.br
.ti -1c
.RI "#define \fBGET_FREE_NODE\fP(X, Y)"
.br
.ti -1c
.RI "#define \fBFOR_EACH_NODE\fP(X, Y)   for((X) = H((Y)); (X); (X) = N((X)))"
.br
.ti -1c
.RI "#define \fBFOR_EACH_NODE_REVERSE\fP(X, Y)   for((X) = T((Y)); (X); (X) = P((X)))"
.br
.ti -1c
.RI "#define \fBINITIALIZE_NODE\fP(NEW, STRUCT, OBJ, FLAG)"
.br
.ti -1c
.RI "#define \fBTRAVERSE_TREE\fP(PTR, TREE, NEW, RES, SIZE)"
.br
.ti -1c
.RI "#define \fBADD_FRONT\fP(X, Y)"
.br
.ti -1c
.RI "#define \fBADD_BACK\fP(X, Y)"
.br
.ti -1c
.RI "#define \fBREMOVE_FRONT\fP(X)"
.br
.ti -1c
.RI "#define \fBREMOVE_BACK\fP(X)"
.br
.ti -1c
.RI "#define \fBPTR_CLEAR\fP(TYPE, OBJ)"
.br
.ti -1c
.RI "#define \fBPTR_STRUCT_SETUP\fP(X, Y, Z)"
.br
.in -1c
.SH "Define Documentation"
.PP 
.SS "#define ADD_BACK(X, Y)"\fBValue:\fP
.PP
.nf
{\
        S((Y))++;\
        P((X)) = T((Y));\
        N((X)) = NULL;\
        N(T((Y))) = (X);\
        T((Y)) = (X);\
}
.fi
.PP
Definition at line 166 of file control_macros.h.
.SS "#define ADD_FREE_NODE(X, Y)"\fBValue:\fP
.PP
.nf
{\
                  Node *__tmp;\
                  __tmp = FL((X));\
                  N((Y)) = __tmp;\
                  P((Y)) = NULL;\
                  if(__tmp) {\
                  P(__tmp) = (Y);\
                  }\
                  FL((X)) = (Y);\
}
.fi
.PP
Definition at line 51 of file control_macros.h.
.SS "#define ADD_FRONT(X, Y)"\fBValue:\fP
.PP
.nf
{\
        S((Y))++;\
        N((X)) = H((Y));\
        P((X)) = NULL;\
        P(H((Y))) = (X);\
        H((Y)) = (X);\
}
.fi
.PP
Definition at line 153 of file control_macros.h.
.SS "#define BASE_INIT(X, Y, Z, S)"\fBValue:\fP
.PP
.nf
{\
        (Y)->API.copy((X)->objptr,(Z),(S));\
        N((X)) = P((X)) = NULL;\
}
.fi
.PP
Definition at line 25 of file control_macros.h.
.SS "#define BASE_INIT2(X, Y, Z)"\fBValue:\fP
.PP
.nf
{\
        (X)->objptr = (Z);\
        N((X)) = P((X)) = NULL;\
}
.fi
.PP
Definition at line 33 of file control_macros.h.
.SS "#define DELETE_OBJPTR(PAR, OBJ)"\fBValue:\fP
.PP
.nf
{\
  if(((PAR)->objfree == FREEOBJ || CHECK_FLAG((OBJ)->flags,STATIC)) && (OBJ)->objptr) {\
          (PAR)->API.dealloc((OBJ)->objptr);\
          (OBJ)->objptr = NULL;\
  }\
}
.fi
.PP
Definition at line 41 of file control_macros.h.
.SS "#define FOR_EACH_NODE(X, Y)   for((X) = H((Y)); (X); (X) = N((X)))"
.PP
Definition at line 93 of file control_macros.h.
.SS "#define FOR_EACH_NODE_REVERSE(X, Y)   for((X) = T((Y)); (X); (X) = P((X)))"
.PP
Definition at line 98 of file control_macros.h.
.SS "#define GET_FREE_NODE(X, Y)"\fBValue:\fP
.PP
.nf
{\
                  (Y) = FL((X));\
                  FL((X)) = N(Y);\
}
.fi
.PP
Definition at line 85 of file control_macros.h.
.SS "#define INITIALIZE_NODE(NEW, STRUCT, OBJ, FLAG)"\fBValue:\fP
.PP
.nf
{\
        if(FL(STRUCT)) {\
                GET_FREE_NODE((STRUCT),(NEW));\
        } else if(!((NEW) = construct_Node(NUM_LINKS))) {\
                goto allocfail;\
        }\
        if((FLAG) == DYNAMIC) {\
                BASE_INIT2((NEW),(STRUCT),(OBJ));\
        } else {\
                if(!((NEW)->objptr = (STRUCT)->API.alloc((STRUCT)->objsize))) {\
                        goto allocobjfail;\
                }\
                BASE_INIT((NEW),(STRUCT),(OBJ),(STRUCT)->objsize);\
        }\
        (NEW)->flags = (FLAG);\
        (NEW)->ptr[LEFT] = NULL;\
        (NEW)->ptr[RIGHT] = NULL;\
}
.fi
.PP
Definition at line 104 of file control_macros.h.
.SS "#define INVALID   0x00"
.PP
Definition at line 22 of file control_macros.h.
.SS "#define LEFT   0x00"
.PP
Definition at line 10 of file control_macros.h.
.SS "#define PTR_CLEAR(TYPE, OBJ)"\fBValue:\fP
.PP
.nf
do {\
        Node *iter, *iter2;\
        \
        CHECK_VARN((OBJ),EINVAL);\
        for(iter = H((OBJ));iter;iter = iter2) {\
                iter2 = N(iter);\
                REMOVE_NODE(iter,(OBJ));\
                DELETE_OBJPTR((OBJ),iter);\
                ADD_FREE_NODE((OBJ),iter);\
        }\
        H((OBJ)) = T((OBJ)) = NULL;\
        S((OBJ)) = 0;\
}while(0)
.fi
.PP
Definition at line 202 of file control_macros.h.
.SS "#define PTR_STRUCT_SETUP(X, Y, Z)"\fBValue:\fP
.PP
.nf
do{\
                int16_t x;\
                Node *ptr;\
                S((X)) = 0;\
                H((X)) = T((X)) = NULL;\
                (X)->objsize = (Y);\
                (X)->objfree = (Z);\
                for(x = 0; x < INITIAL_SIZE; x++) {\
                        ptr = construct_Node(NUM_LINKS);\
                        ADD_FREE_NODE((X),ptr);\
                }\
        }while(0)
.fi
.PP
Definition at line 219 of file control_macros.h.
.SS "#define REMOVE_BACK(X)"\fBValue:\fP
.PP
.nf
{\
        S((X))--;\
        if(S((X))) {\
                T((X)) = P(T((X)));\
                N(T((X))) = NULL;\
        } else { \
                T((X)) = H((X)) = NULL;\
        }\
}
.fi
.PP
Definition at line 190 of file control_macros.h.
.SS "#define REMOVE_FRONT(X)"\fBValue:\fP
.PP
.nf
{\
        S((X))--;\
        if(S((X))) { \
                H((X)) = N(H((X)));\
                P(H((X))) = NULL;\
        } else {\
                T((X)) = H((X)) = NULL;\
        }\
}
.fi
.PP
Definition at line 177 of file control_macros.h.
.SS "#define REMOVE_NODE(X, Y)"\fBValue:\fP
.PP
.nf
{\
        if(H(Y) == (X)) {\
                H(Y) = N(X);\
        }\
        if(T(Y) == (X)) {\
                T(Y) = P(X);\
        }\
        if(P((X))) {\
                N(P((X))) = N((X));\
        }\
        if(N((X))) {\
                P(N((X))) = P((X));\
        }\
        S(Y)--;\
}
.fi
.PP
Definition at line 65 of file control_macros.h.
.SS "#define RIGHT   0x01"
.PP
Definition at line 11 of file control_macros.h.
.SS "#define TRAVERSE_TREE(PTR, TREE, NEW, RES, SIZE)"
.PP
Definition at line 126 of file control_macros.h.
.SS "#define VALID   0x01"
.PP
Definition at line 21 of file control_macros.h.
.SH "Author"
.PP 
Generated automatically by Doxygen for 'c generic library' from the source code.
